package com.ruoyi.web.dto;

import lombok.Data;

/**
 * <br>
 *
 * @author chenwujie
 * @date 2021/2/11
 */
@Data
public class BaseResp<T> {
    private int code;
    private String msg;
    private T data;

    private BaseResp() {
    }

    public static <T> BaseResp<T> success(T data) {
        BaseResp<T> result = new BaseResp<>();
        result.code = 0;
        result.data = data;
        return result;
    }

    public static <T> BaseResp<T> fail(String msg) {
        BaseResp<T> result = new BaseResp<>();
        result.code = 500;
        result.msg = msg;
        return result;
    }
}
